<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false" language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<script type="text/javascript">
   $(function(){
       $.ajax({
           url:"${pageContext.request.contextPath}/User/selectSexCount.do",
           async:false,
           success:function(data) {
               aa=data.sexcount;
               console.log(aa);
               // 基于准备好的dom，初始化echarts实例
               var myChart = echarts.init(document.getElementById('main2'));
               console.log(aa+"----------");
               option = {
                   title : {
                       text: '某站点用户访问来源',
                       subtext: '纯属虚构',
                       x:'center'
                   },
                   tooltip : {
                       trigger: 'item',
                       formatter: "{a} <br/>{b} : {c} ({d}%)"
                   },
                   legend: {
                       orient: 'vertical',
                       left: 'left',
                       data: [
                           '男','女'
                       ]
                   },
                   series : [
                       {
                           name: '访问来源',
                           type: 'pie',
                           radius : '55%',
                           center: ['50%', '60%'],
                           data:[
                               {value:aa[0].value, name:aa[0].name},
                               {value:aa[1].value, name:aa[1].name},
                           ],
                           itemStyle: {
                               emphasis: {
                                   shadowBlur: 10,
                                   shadowOffsetX: 0,
                                   shadowColor: 'rgba(0, 0, 0, 0.5)'
                               }
                           }
                       }
                   ]
               };
               // 使用刚指定的配置项和数据显示图表。
               myChart.setOption(option);
           }
       });
   })
</script>
<div id="main2" style="width: 600px;height:400px;"></div>